package com.asset.salesforce.dao;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.stereotype.Repository;

import com.asset.salesforce.domain.ActionField;

@Repository
public class ActionFieldDaoImpl extends BasicDaoImpl<ActionField> {


	@SuppressWarnings("unchecked")
	public List<ActionField> getAllFieldsByTypeId(Integer typeId) {
		 Session session = sessionFactory.getCurrentSession();
		 Query query = session.createQuery("from ActionField a  where a.actionType.id = :typeId");
		 query.setParameter("typeId", typeId);
		 List<ActionField> actionFields = new ArrayList<ActionField>();
		 actionFields = query.list();
		 System.out.println(">>>>>>>><<<<>>><<<<<<<<"+actionFields.size());
	      return actionFields ;
		 
	}
	
}